<template>
  <div>
    <js-table :border="true" :tableData="list" :colunm="colunm">
      <!--  -->
      <template #createAt="row">
        <div>{{ new Date(row.row.createAt).toLocaleString() }}</div>
      </template>
      <template #isstate="row">
        <div>
          {{ row.row.isstate }}
        </div>
      </template>
      <template #ctrl>
        <div>
          <el-link type="primary">编辑</el-link>
          <el-link type="danger">删除</el-link>
        </div>
      </template>
    </js-table>
  </div>
</template>
<script>
import jsTable from '../../components/jsTable.vue'
import { _getStudent } from '../../api/student'
export default {
  data () {
    return {
      list: [], //表格数据
      colunm: [
        //表头
        { label: '用户名', prop: 'userName', isSlot: false, width: 180 },
        { label: '手机号', prop: 'phone', isSlot: false, width: 180 },
        { label: '邮箱', prop: 'email', isSlot: false, width: 180 },
        { label: '创建日期', prop: 'createAt', isSlot: true, width: 180 },
        { label: '是否冻结', prop: 'isstate', isSlot: true, width: 180 },
        { label: '操作', prop: 'ctrl', isSlot: true, width: 280 }
      ]
    }
  },
  components: {
    jsTable
  },
  created () {
    this.getStu()
  },
  methods: {
    async getStu () {
      var res = await _getStudent({
        pageStart: 1
      })
      this.list = res.data.list
      console.log(this.list)
    }
  }
}
</script>
<style lang="less"></style>
